<template>
  <el-row>
    <el-col :span="24">
      <el-tabs v-model="activeName">
        <el-tab-pane label="订单信息" name="1">
          <keep-alive>
            <order-info expatriate @refresh="refresh" v-if="activeName == 1" :detail="detail"></order-info>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="服务信息" name="2">
          <keep-alive>
            <service-info v-if="activeName == 2" :id="id" :orderId="orderId">
              <div slot="tools">
                <div><el-button type="primary" @click="additionalFees">追加费用</el-button></div>
                <!--<div><el-button type="text" @click="feesDetail">查看费用详情</el-button></div>-->
              </div>
            </service-info>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="报价记录" name="3">
          <keep-alive>
            <quote-info v-if="activeName == 3" :id="id" :orderId="orderId" :detail="detail" flag="inService"></quote-info>
          </keep-alive>
        </el-tab-pane>
        <el-tab-pane label="跟进记录" name="4">
          <keep-alive>
            <FollowUp v-if="activeName == 4" :id="id" :objectId="objectId" :objectType="objectType"></FollowUp>
          </keep-alive>
        </el-tab-pane>
      </el-tabs>
    </el-col>
    <modal-fees-detail ref="modalFeesDetail" :orderId="id"></modal-fees-detail>
  </el-row>
</template>
<script>
import OrderInfo from '@/views/oms/orders/serviceOrders/detail/OrderInfo'
import ServiceInfo from '@/views/oms/orders/expatriate/detail/ServiceInfo'
import QuoteInfo from '@/views/oms/orders/expatriate/detail/QuoteInfo'
import modalFeesDetail from '@/views/fhb/myOrders/components/modal/modalFeesDetail'
import {unixTimestampFilter, filterDataBaseDictionary, decimalNumFilter} from '@/filters'
import FollowUp from '@/views/oms/business/FollowUp'
export default {
  name: 'serviceOrdersShow',
  components: {
    FollowUp,
    OrderInfo,
    ServiceInfo,
    QuoteInfo,
    modalFeesDetail
  },
  filters: {
    decimalNumFilter,
    filterDataBaseDictionary,
    unixTimestampFilter
  },
  data() {
    return {
      activeName: this.$route.query.tab ? String(this.$route.query.tab) : '1',
      objectId: this.$route.query.objectId ? String(this.$route.query.objectId) : '',
      objectType: this.$route.query.objectType ? String(this.$route.query.objectType) : '',
      id: this.$route.params.id,
      orderId: this.$route.query.orderId,
      detail: {}
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    getDetail() {
      this.$ajax.get('/ms-terminal-order/orderData/getOrderDatails', {orderId: this.orderId}).then(response => {
        if (!response.data) {
          return
        }
        this.detail = response.data || {}
      })
    },
    // 费用详情
    feesDetail() {
      this.$refs.modalFeesDetail.show()
    },
    // 追加费用
    additionalFees() {
      this.$router.push({path: '/ss-oms/orders/expatriate/inService/paymentAdditional/' + this.id, query: {orderId: this.orderId}})
    },
    refresh() {
      this.getDetail()
    }
  }
}
</script>
